﻿using Abp.Application.Services.Dto;
using Abp.Application.Services;
using System;
using Choucius.Boilerplate9.ProductionLines.Dto;
using Abp.Domain.Repositories;
using System.Threading.Tasks;

namespace Choucius.Boilerplate9.ProductionLines
{
    public class ProductionLineAppService : AsyncCrudAppService<ProductionLine, ProductionLineDto, Guid, PagedResultRequestDto, CreateUpdateProductionLineDto, CreateUpdateProductionLineDto>, IProductionLineAppService
    {
        private readonly IRepository<ProductionLine, Guid> _repository;

        public ProductionLineAppService(IRepository<ProductionLine, Guid> repository) : base(repository)
        {
            _repository = repository;
        }

        public Task<ProductionLine> TestSave()
        {
            var entity = new ProductionLine()
            {
                LineCode = DateTime.Now.ToString("yyyyMMddhhmmss"),
                LineName = "定时创建测试产线",
                CreationTime = DateTime.Now
            };
            var result = _repository.Insert(entity);
            return Task.FromResult(result);
        }
    }
}
